#import "collaboration.h"

#define DEFAULT_EVENT_TYPE 0

/**
* @brief Clase que modela un evento generico
* @author Carlos Rodriguez Dominguez
*
* Esta clase se utilizara para modelar los diversos eventos
* que se usaran en el sistema. Cada evento debera tener una serie
* de campos creados mediante "create_member". Los listeners se
* encargaran de captar unos u otros eventos realizando los tests
* que consideren pertinentes mediante las funciones "exists_member",
* "member_value", "count_members", etc. Por defecto contiene un
* campo llamado "type" donde se guarda el tipo de evento especifico,
* que permitira tambien establecer filtros mediante listeners.
* Por defecto tiene un campo llamado "type" que contendra inicialmente
* el valor definido por DEFAULT_EVENT_TYPE. Este campo permitira diferenciar
* unos tipos de eventos de otros.
*/
@interface Event : NSObject {
	CollaborationMutableEvent* event; /**< Estructura que modela un evento */
	id<ICECommunicator> comm;
}

-(id) initWithEvent:(Event*)evt;
-(id) initWithCommunicator:(id<ICECommunicator>)communicator;
-(id) initWithInternalEvent:(CollaborationEvent*)evento andCommunicator:(id)communicator;
-(BOOL) existsMember:(NSString*)name;
-(CollaborationEventData*) memberValue:(NSString*)name;	
-(void) setMember:(NSString*)name value:(CollaborationEventData*)value;
-(NSUInteger) countMembers;
-(int) type;
-(CollaborationMutableEvent*) internalEvent;

-(BOOL) interpretBool:(CollaborationEventData*)ev;
-(unsigned char) interpretByte:(CollaborationEventData*)ev;
-(short) interpretShort:(CollaborationEventData*)ev;
-(int) interpretInt:(CollaborationEventData*)ev;
-(long) interpretLong:(CollaborationEventData*)ev;
-(float) interpretFloat:(CollaborationEventData*)ev;
-(double) interpretDouble:(CollaborationEventData*)ev;
-(NSString*) interpretString:(CollaborationEventData*)ev;

/*
-(NSArray*) interpretBoolSeq:(CollaborationEventData*)ev;
-(NSArray*) interpretByteSeq:(CollaborationEventData*)ev;
-(NSArray*) interpretShortSeq:(CollaborationEventData*)ev;
-(NSArray*) interpretIntSeq:(CollaborationEventData*)ev;
-(NSArray*) interpretLongSeq:(CollaborationEventData*)ev;
-(NSArray*) interpretFloatSeq:(CollaborationEventData*)ev;
-(NSArray*) interpretDoubleSeq:(CollaborationEventData*)ev;*/
-(NSArray*) interpretStringSeq:(CollaborationEventData*)ev;

-(CollaborationEventData*) fromBool:(BOOL)b;
-(CollaborationEventData*) fromByte:(unsigned char)b;
-(CollaborationEventData*) fromShort:(short)b;
-(CollaborationEventData*) fromInt:(int)b;
-(CollaborationEventData*) fromLong:(long)b;
-(CollaborationEventData*) fromFloat:(float)b;
-(CollaborationEventData*) fromDouble:(double)b;
-(CollaborationEventData*) fromString:(NSString*)b;

/*
-(CollaborationEventData*) fromBoolSeq:(NSArray*)b;
-(CollaborationEventData*) fromByteSeq:(NSArray*)b;
-(CollaborationEventData*) fromShortSeq:(NSArray*)b;
-(CollaborationEventData*) fromIntSeq:(NSArray*)b;
-(CollaborationEventData*) fromLongSeq:(NSArray*)b;
-(CollaborationEventData*) fromFloatSeq:(NSArray*)b;
-(CollaborationEventData*) fromDoubleSeq:(NSArray*)b;*/
-(CollaborationEventData*) fromStringSeq:(NSArray*)b;

@end
